from ftp import FtpSender


class TransDely(object):
	def __init__(self, local_path):
		self.files      = []
		self.recipeDely = None
		self.local_path = local_path
		self.errors	= None
		self.ftp	= FtpSender()

	def Send(self, files, recipeDely):
		self.files      = files
		self.recipeDely = recipeDely
		
		(ret, self.errors) = self.ftp.Connect(self.recipeDely.Host, self.recipeDely.User, self.recipeDely.Passwd)
		if ret:
			(ret, self.errors) = self.ftp.Cwd(self.recipeDely.Path)
			if ret:
				for f in files:
					(ret, self.errors) = self.ftp.Send(self.local_path + f, f)
					if ret == False:
						break;
				
		self.ftp.Disconnect()
		return ret


